home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / bin / dpio < prev    next >
Text File  |  1995-07-22  |  974b  |  56 lines

  1. :
  2. # dpio - use cpio to archive the specified directories to tape
  3. #        or read a cpio archive
  4. # Written 22 Dec 93 by Ronald Joe Record (rr@sco.com) after having
  5. # executed "man cpio" hundreds of times over the last decade.
  6. #
  7. # Normal use of this script would be to read or write a cpio archive
  8. # from/to a 150 Mb cartridge tape. The usual invocation would be
  9. # "dpio -i" to read and "dpio dir1 dir2 dir3" or "dpio ." to write.
  10. #
  11.  
  12. usage() {
  13.     echo "Usage: dpio [-itvu] [-K Volume-size] [-f file] [dir list ...]"
  14.     exit 1
  15. }
  16.  
  17. DIRS=
  18. VOLSIZ=150000
  19. DEVICE=/dev/rct0
  20. V=
  21. T=
  22. READ=
  23.  
  24. while getopts itvuK:f: c
  25. do
  26.     case $c in
  27.         K)  VOLSIZ=$OPTARG
  28.             ;;
  29.         f)  DEVICE=$OPTARG
  30.             ;;
  31.         i)  READ=1
  32.             ;;
  33.         t)  T=t
  34.             ;;
  35.         u)  usage
  36.             ;;
  37.         v)  V=v
  38.             ;;
  39.         ?)  usage
  40.             ;;
  41.     esac
  42. done
  43. shift `expr $OPTIND - 1`
  44.  
  45. DIRS=$*
  46.  
  47. [ "$DIRS" = "" ] && [ "$READ" = "" ] && usage
  48.  
  49. if [ "$READ" ]
  50. then
  51.     cpio -icd${T}${V}B -I$DEVICE
  52. else
  53.     find $DIRS -depth -print | cpio -oc${T}${V}BK $VOLSIZ -O$DEVICE
  54. fi
  55.